//
//  MainController.m
//  DeviceManage
//
//  Created by zxl on 2020/10/19.
//  Copyright © 2020年 sjl. All rights reserved.
//

#import "MainController.h"

@interface MainController ()

@end

@implementation MainController
-(void)setupViewControllers{
    // 1.设置首页导航控制器
    HomeViewController *homeViewController=[[HomeViewController alloc]init];
    UINavigationController *homeNavi=[[UINavigationController alloc]
                                      initWithRootViewController:homeViewController];
    [self addChildViewController:homeNavi];
    // 2.设置咨询导航控制器
    InfomationViewController *infoViewController=[[InfomationViewController alloc]init];
    UINavigationController *infoNavi=[[UINavigationController alloc]
                                      initWithRootViewController:infoViewController];
    [self addChildViewController:infoNavi];
    // 3.设置购物车导航控制器
    Shopingcart_ViewController *shopingCartViewController = [[Shopingcart_ViewController
                                                             alloc] init];
    UINavigationController *shopNavi  = [[UINavigationController alloc]
                                        initWithRootViewController:shopingCartViewController];
    [self addChildViewController:shopNavi];
    // 4.设置我的导航控制器
    MineViewController *mineViewController = [[MineViewController alloc] init];
    UINavigationController *mineNavi = [[UINavigationController alloc]
                                        initWithRootViewController:mineViewController];
    [self addChildViewController:mineNavi];
}


//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}
-(instancetype)init{
    if (self=[super init]) {
        // 设置 TabBar 的 4 个视图控制器
        [self setupViewControllers];
    }  return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // 将黑色背景改成白色背景
    self.view.backgroundColor = UIColor.whiteColor;
} 

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
